import React from 'react'
import { WingBlank, WhiteSpace } from 'antd-mobile'
import Step from '../Step'
import Result from '../Result'
import CommonHeader from 'COMPONENT/CommonHeader';
import {getUrlParams} from 'UTIL/commonUtil';
import './index.less'
// ========================================
class Schedules extends React.Component {
    constructor (props) {
        super(props);
        this.state = {
            num: 0
        };
    }
    
    componentWillMount () {
		let urlParams = getUrlParams();  
    	let nums = urlParams['itemNums'];
    	this.setState({
            num: nums || 3
        });
    }
    
    componentDidMount () {
        console.log('this.props.location.state:', this.props.location.state);
        let that = this;
        /*this.setState({
            num: that.props.location.state.num
        });*/
    }
    render() {
        let that = this;
        let stepsArr = [];

        for (var i = 0; i < that.state.num; i++) {
            if (i === that.state.num - 1) {
                stepsArr.push(
                    <Step date="20180909" title="¥337.59" txt="含本金331.11+利息6.48" circel={(i + 1) + '期'} line={false} />
                );
            } else {
                stepsArr.push(
                    <Step date="20180909" title="¥337.59" txt="含本金331.11+利息6.48" circel={(i + 1) + '期'} line={true} />
                );
            }
        }
        return (
            <div>
           		<CommonHeader 
					name='还款计划表试算'					
					leftContentTitle="@back" 
					leftContent='返回'				
				/>
				<div style={{height:'.9rem'}}></div>
                <div id="notice">
                    重要提示：本还款计划表仅为试算，最终以贷款发放后实际生成的还款计划表为准。
                </div>
                <div id="total">
                    <div className="total-title">还款总额：¥415,523.78</div>
                    <div className="total-txt">
                        贷款日利率：万分之2.0139
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        利息总额：15,513.78
                    </div>
                </div>
                <WhiteSpace size="lg" />
                <WingBlank size="lg">
                    {stepsArr}
                </WingBlank>
                {/*<Result icon="check-circle-o" title="提交成功" content="房屋抵押贷款已提交。" />*/}
                {/*<Result icon="check-circle-o" title="提交成功" content="房屋抵押贷款已提交。"*/}
                        {/*a1="借款凭证" a2="查看还款计划" />*/}
            </div>
        );
    }
}
// ========================================
export default Schedules;